package com.rico.gallery.view;

import android.app.Activity;
import android.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.rico.gallery.R;
public class LoginAlertDialog {
    private static String TAG="LoginAlertDialog";

    private AlertDialog loginDialog;

    private Button loginBtn;

    private  View view;

    public LoginAlertDialog(Activity activity){
        LayoutInflater inflater = (LayoutInflater) activity.getApplicationContext().getSystemService(activity.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.activity_login, null);
        loginBtn=(Button)view.findViewById(R.id.btn_login);
        AlertDialog.Builder ad =new AlertDialog.Builder(activity);
        ad.setView(view);
        ad.setTitle("输入密码登陆");
        loginDialog=ad.create();
    }

    public View findViewById(int id){
        return view.findViewById(id);
    }

    public void setOnClickListener(View.OnClickListener onClickListener){
        loginBtn.setOnClickListener(onClickListener);
    }

    public void show(){
        loginDialog.show();
    }
    public void dimiss(){
        loginDialog.dismiss();
    }
}
